//
//  CYBindCardWillPaymentCell.m
//  cyjf
//
//  Created by tauCross on 2017/5/19.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYBindCardWillPaymentCell.h"



@implementation CYBindCardWillPaymentCellObject

@end



@interface CYBindCardWillPaymentCell ()

@property(nonatomic, strong)UILabel *amountLabel;

@end


@implementation CYBindCardWillPaymentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = APP_DEFAULT_COLOR_BLUE;
        
        self.amountLabel = [[UILabel alloc] init];
        self.amountLabel.textColor = HEXCOLOR(@"FFFFFF");
        self.amountLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
        [self.contentView addSubview:self.amountLabel];
    }
    return self;
}

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
    return 65;
}

- (BOOL)shouldUpdateCellWithObject:(CYBindCardWillPaymentCellObject *)object
{
    self.amountLabel.text = [NSString stringWithFormat:@"银行卡支付金额:%@元", object.amount.amountString];
    
    [self setNeedsLayout];
    return YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.amountLabel sizeToFit];
    self.amountLabel.centerY = self.contentView.height / 2;
    self.amountLabel.left = 20;
}

@end
